  <div class="content-section introduction">
    <div>
      <span class="feature-title">新增计划</span>
    </div>
  </div>
  <div class="content-section implementation GridDemo inspection ">
    <form class="form-horizontal" [formGroup]="newInspectionPlan" (ngSubmit)="formSubmit()" >
      <p-panel>
        <p-header>
          <div class="ui-helper-clearfix">
            <span class="ui-panel-title" style="font-size:16px;display:inline-block;margin-top:2px">基本信息</span>
            <button  pButton type="submit" [ngStyle]="{'float':'right'}" label="提交" [disabled]="!newInspectionPlan.valid"></button>
          </div>
        </p-header>
        <div class="form-group ui-fluid  " >
          <label  class="col-sm-2 col-md-2 col-lg-2 col-lg-pull-1  control-label"><span>*</span>计划名称:</label>
          <div class="col-md-3 col-sm-4  col-lg-pull-1 ">
            <input  name="inspectionName" formControlName="inspectionName" type="text" pInputText   placeholder="请填写计划名称" [(ngModel)]="submitData.name">
            <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="!newInspectionPlan.controls['inspectionName'].valid&&(!newInspectionPlan.controls['inspectionName'].untouched)" >
              <i class="fa fa-close"></i>
              计划名称必填
            </div>
          </div>
          <label  class=" col-md-2 col-sm-1 control-label"><span>*</span>巡检部门:</label>
          <div class=" col-md-5 col-sm-4">
            <div class="ui-g-8 ui-fluid-no-padding">
              <input type="text" pInputText formControlName="inspectiondepartment" name="inspectiondepartment" placeholder="请选择巡检部门"
                     readonly class="cursor_not_allowed" [(ngModel)]="submitData.orggans_name" />
              <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="!newInspectionPlan.controls['inspectiondepartment'].valid&&(!newInspectionPlan.controls['inspectiondepartment'].untouched)" >
                <i class="fa fa-close"></i>
                巡检部门必填
              </div>
            </div>
            <div class="ui-g-2 ui-fluid-no-padding ui-padding-10px">
              <button pButton  type="button" (click)="showAddInspectionPlanMask()" label="选择"></button>
            </div>
            <div class="ui-g-2 ui-fluid-no-padding ui-padding-10px">
              <button pButton  type="button" (click)="clearTreeDialog()" label="清空"></button>
            </div>
          </div>
      </div>
        <div class="form-group ui-fluid " formGroupName="timeGroup" >
          <label  class="col-lg-2 col-md-2 col-sm-2 col-lg-pull-1   control-label"><span>*</span>开始时间:</label>
          <div class="col-md-3 col-sm-4  col-lg-pull-1 ">
            <p-calendar [(ngModel)]="submitData.start_time"
                        [showIcon]="true"
                        [locale]="zh"
                        formControlName="startTime"
                        [styleClass]="'schedule-add'"
                        dateFormat="yy-mm-dd"
                        [required]="true"
                        [showTime]="true"
                        dataType="string"
                        [minDate]="nowDate"
                        [showSeconds]="true" >
            </p-calendar>
            <div [hidden]="newInspectionPlan.get(['timeGroup','startTime']).valid||newInspectionPlan.get(['timeGroup','startTime']).untouched">
              <div class="ui-message ui-messages-error ui-corner-all"  [hidden]="!newInspectionPlan.hasError('required',['timeGroup','startTime'])">
                <i class="fa fa-close"></i>
                开始时间必填
              </div>
            </div>
          </div>
          <label  class="col-md-2 col-sm-1 control-label"><span>*</span>结束时间:</label>
          <div class="col-md-4 col-sm-4">
            <p-calendar [(ngModel)]="submitData.end_time" [showIcon]="true" [locale]="zh" formControlName="endTime"
                        [styleClass]="'schedule-add'" dateFormat="yy-mm-dd" [required]="true" dataType="string"
                        [minDate]="nowDate"  id="endCalendar"  [showTime]="true" [showSeconds]="true" >
            </p-calendar>
            <div [hidden]="newInspectionPlan.get(['timeGroup','endTime']).valid||newInspectionPlan.get(['timeGroup','endTime']).untouched">
              <div class="ui-message ui-messages-error ui-corner-all"  [hidden]="!newInspectionPlan.hasError('required',['timeGroup','endTime'])" >
              <i class="fa fa-close"></i>
              结束时间必填
              </div>
              <!--{{newInspectionPlan.get(['timeGroup','endTime']).untouched}}-->

            </div>
            <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="newInspectionPlan.hasError('time','timeGroup')" >
              <i class="fa fa-close"></i>
              <!--结束时间不能小于开始时间-->
              {{newInspectionPlan.getError('time','timeGroup')?.descxxx}}
            </div>
          </div>
        </div>
        <div class="form-group ui-fluid " >
          <label  class="col-md-2 col-sm-1 col-lg-2  col-lg-pull-1 control-label"><span>*</span>巡检内容:</label>
          <div class="col-md-10 col-sm-9  col-lg-pull-1 ">
            <select multiple [(ngModel)]="submitData.inspection_content_cids" formControlName="inspectionContent" name="inspectionContent" >
              <option  *ngFor="let content of inspectionContents" value="{{content.cid}}">{{content.name}}</option>
            </select>
            <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="!newInspectionPlan.controls['inspectionContent'].valid&&(!newInspectionPlan.controls['inspectionContent'].untouched)" >
              <i class="fa fa-close"></i>
              巡检内容必填
            </div>
          </div>
        </div>
      </p-panel>
    </form>
  </div>
 <app-add-inspection-plan-tree
  *ngIf="showAddPlanMask"
  (closeAddMask)="closeAddPlanTreeMask($event)"
  (addTree)="addPlanOrg($event)">
</app-add-inspection-plan-tree>

